﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace StrategyGame
{
	/// <summary>
	/// Tech tree screen, handles setting and displaying research info + progress
	/// </summary>
	class TechTreeScreen
	{
		#region Static resources
		
		static SpriteFont MainFont;
		static SpriteFont HeaderFont;

		public static void LoadContent(ContentManager content)
		{
			MainFont = content.Load<SpriteFont>("fonts/SmallFont");
			HeaderFont = content.Load<SpriteFont>("fonts/LargeFont");
		}

		#endregion

		public void Draw(SpriteBatch sprites, Rectangle draw_rect, Nation playernation)
		{
			TechTree techtree = playernation.Research;

			Vector2 textpos = new Vector2(24, 24);
			int line_height = (int)MainFont.MeasureString("|").Y;

			techtree.ForEachNode((node, depth) =>
				{
					textpos.Y += line_height;
					textpos.X = 24 * depth;

					sprites.DrawString(MainFont, node.TechName, textpos, Color.White);
				});
		}
	}
}
